using SqlSugar;
using IM.Easy.Core.Services;
using IM.Easy.Core.Utils;
using IM.Easy.Infrastructure.Query;
using IM.Easy.Core.Extensions;
using IM.Easy.Entity.System;
using IM.Easy.SystemServices.Dtos;
using IM.Easy.SystemServices.IServices;

namespace IM.Easy.SystemServices.Services
{
    public class SvgIconsService : AppServices<SvgIcons>, ISvgIconsService
    {

        public SvgIconsService(ISqlSugarClient db) : base(db)
        {

        }

        public SvgIcons Create(SvgIcons entity)
        {
            // TODO: 添加创建逻辑
            return Context.Insertable(entity).ExecuteReturnEntity();
        }

        public SvgIcons GetById(long id)
        {
            // TODO: 添加获取逻辑
            return Context.Queryable<SvgIcons>().InSingle(id);
        }

        public PageResponse<SvgIcons> GetPageList(SvgIconsQueryDto query)
        {
            var queryable = Context.Queryable<SvgIcons>();
            var exp = Expressionable.Create<SvgIcons>();
            exp = exp
;
            var page = queryable
                 .Where(exp.ToExpression())
                 .ToPageList<SvgIcons, SvgIcons>(query);
            return page;
        }

        public bool Update(SvgIcons entity)
        {
            // TODO: 添加更新逻辑
            return Context.Updateable(entity).ExecuteCommandHasChange();
        }

        public bool Delete(params long[] Id)
        {
            // TODO: 添加删除逻辑
            return Context.Deleteable<SvgIcons>(Id).ExecuteCommandHasChange();
        }
    }
}
